#include <fstream>
#include <cstring>
#include "calculator.h"

int main( )
{
    std::ifstream fin( "input.txt" );
    std::ofstream fout( "output" );
    std::string input;
    calculator cal;

    while ( fin >> input )
    {
        cal.init( input );
        double result;
        bool err = false;
        try
        {
            result = cal.calc( );
        }
        catch(...)
        {
            err = true;
        }
        if( !err ) fout << result << std::endl;
    }

    return 0;
}